package f.h.dragon.util;

import java.util.Collection;
import java.util.Map;
import java.util.Set;


/**
 * EmptyMap: empty map
 *
 * @author Wenlong Meng(wenlong.meng@gmail.com)
 * @version 1.0 at 2012/06/20
 * @since 1.0
 */
public class EmptyMap<K, V> implements Map<K, V> {

	//Query Operations
	/**
     * Returns 0 - it is empty.
     *
     * @return  0 - it is empty
     */
	@Override
	public int size() {
		return 0;
	}

	/**
     * Returns <tt>true</tt> if this list contains no elements.
     *
     * @return <tt>true</tt> if this list contains no elements
     */
	@Override
	public boolean isEmpty() {
		return true;
	}

	/**
     * Returns <tt>true</tt> if this map contains an Entry pair with the specified key.
     *
     * @param key key component for an Entry pair whose presence in this map is to be tested.
     * @return <tt>true</tt> if this map contains the specified Entry pair..
     */
	@Override
	public boolean containsKey(Object key) {
		return false;
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public V get(Object key) {
		throw new UnsupportedOperationException();
	}

	// Modification Operations
	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public V put(K key, V value) {
		throw new UnsupportedOperationException();
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public V remove(Object key) {
		throw new UnsupportedOperationException();
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public void clear() {
		throw new UnsupportedOperationException();
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public Set<K> keySet() {
		throw new UnsupportedOperationException();
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public Set<Map.Entry<K, V>> entrySet() {
		throw new UnsupportedOperationException();
	}

	/**
     * Returns <tt>true</tt> if this map maps one or more keys to the
     * specified value.  More formally, returns <tt>true</tt> if and only if
     * this map contains at least one mapping to a value <tt>v</tt> such that
     * <tt>(value==null ? v==null : value.equals(v))</tt>.  This operation
     * will probably require time linear in the map size for most
     * implementations of the <tt>Map</tt> interface.
     *
     * @param value value whose presence in this map is to be tested
     * @return <tt>true</tt> if this map maps one or more keys to the
     *         specified value
     * @throws ClassCastException if the value is of an inappropriate type for
     *         this map (optional)
     * @throws NullPointerException if the specified value is null and this
     *         map does not permit null values (optional)
     */
	@Override
	public boolean containsValue(Object value) {
		return false;
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public void putAll(Map<? extends K, ? extends V> m) {
		throw new UnsupportedOperationException();
	}

	/**
	 * Thrown to indicate that the requested operation is not supported.
	 */
	@Override
	public Collection<V> values() {
		throw new UnsupportedOperationException();
	}

}
